The Tab View Component > FTabView.addListener()

 

FTabView.addListener()

Availability

Flash Player 6.

Usage

myTab_tbv.addListener (listener)

Parameters

listener An Object with event methods attached.

Returns

Returns a Boolean value indicating whether or not the listener was successfully added.

Description

Adds a listener to the component, which can capture and respond to the 2 events fired by the component. The events are: onEnable and onSelect.

onEnable

Event which is triggered by the Tab View whenever it is enabled or disabled with the method setEnabled.

onSelect

Event which is triggered by the Tab View whenever it is a new tab is selected by the user or with the setSelectedIndex method

 

Example

The tab_addListener.fla example file contains an example of using this method.

The following code creates a Tab component with 3 sections, and then adds a listener to listen for the onSelect event.:

	var tabs = ["Tab 1","Tab 2","Tab 3","Tab 4"];
	myTab_tbv.setDataProvider(tabs);

	var listener = {};
	listener.onSelect = function(obj,item){
	   trace("Tab Selected: "+item.label);
	}
	myTab_tbv.addListener(listener);

See also

onEnable()

onSelect()

FTabView.removeListener()